package com.white.androidstudy.aidl;

import android.os.Parcel;
import android.os.Parcelable;

/**
 * Created by yutf on 2017/7/17 0017.
 */

public class Book implements Parcelable
{
    public int id;
    public String name;
    public float price;

    @Override
    public int describeContents()
    {
        return 0;
    }

    @Override
    public void writeToParcel(Parcel dest, int flags)
    {
        dest.writeInt(this.id);
        dest.writeString(this.name);
        dest.writeFloat(this.price);
    }

    public Book()
    {
    }

    public Book(int id, String name)
    {
        this.id = id;
        this.name = name;
    }

    protected Book(Parcel in)
    {
        this.id = in.readInt();
        this.name = in.readString();
        this.price = in.readFloat();
    }

    public static final Creator<Book> CREATOR = new Creator<Book>()
    {
        @Override
        public Book createFromParcel(Parcel source)
        {
            return new Book(source);
        }

        @Override
        public Book[] newArray(int size)
        {
            return new Book[size];
        }
    };
}
